//
// Created by Cybaster on 2024/3/30.
//

#ifndef HELPER_H
#define HELPER_H


#include <opencv2/opencv.hpp>

#include <vector>
#include <map>

namespace stitch {


    cv::Mat stitch(const cv::Mat &baseImg, const cv::Mat &attachImg, const cv::Matx33f &H);


    cv::Mat
    drawMatches(const cv::Mat &img1, const cv::Mat &img2, std::vector<cv::Vec3f> &p1, std::vector<cv::Vec3f> &p2);


    struct RawOrbMatches {
        std::vector<cv::Vec3f> keypoints1;
        std::vector<cv::Vec3f> keypoints2;

        struct Match {
            unsigned closest;
            float closestDistance;
            unsigned secondClosest;
            float secondClosestDistance;
        };

        std::map<unsigned, Match> matches_1_2;

        std::map<unsigned, Match> matches_2_1;
    };


    RawOrbMatches extractRawOrbMatches(const cv::Mat &img1, const cv::Mat &img2);


}


#endif // HELPER_H
